<template>
  <div class="life">
    <div class="lifeWrap">
      <router-link to="/components/ClientComponents/life/lifeIndex" tag="div" class="life-item life-item-jump" replace>
        <img :src="page == 'lifeIndex'?'../../../static/img/life1d.png':'../../../static/img/life1.png'" alt="">
        <div>首页</div>
      </router-link>
      <div class="life-item life-item-pt" @click="popupShow">
        <img src="../../../static/img/fabu111.png" alt="">
        <div>发布</div>
      </div>
      <router-link to="/components/ClientComponents/life/lifeMy" tag="div" class="life-item life-item-jump" replace>
        <img :src="page == 'lifeMy'?'../../../static/img/life2.png':'../../../static/img/life2d.png'" alt="">
        <div>我的</div>
      </router-link>
      <van-popup v-model="show" position="bottom">
        <div class="popBox">
<!--          <img src="../../static/img/beijingtu.png" alt="">-->
          <div class="popItem" @click="jump('posting')">
            <img src="../../../static/img/shq1.png" alt="">
            <span>资讯发布</span>
          </div>
          <div class="popItem">
            <p @click="jump('lifeTwoHandsFaBu')">
              <img src="../../../static/img/shq2.png" alt="">
              <span>二手商品</span>
            </p>
            <img src="../../../static/img/closeTu.png" alt="" @click="close">
          </div>
          <div class="popItem" @click="jump('postOfRelease')">
            <img src="../../../static/img/shq4.png" alt="">
            <span>兼职发布</span>
          </div>
        </div>
      </van-popup>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
  import Vue from 'vue';
  import {Popup} from 'vant';

  Vue.use(Popup);
  export default {
    name: "life",
    data() {
      return {
        page: 'lifeIndex',
        show: false
      }
    },
    mounted() {
      let str = this.$route.path;
      this.page = str.replace('/components/ClientComponents/life/', '');
    },
    watch: {
      $route(to, from) {
        this.page = to.path.replace('/components/ClientComponents/life/', '');
        console.log(this.page)
      }
    },
    methods: {
      popupShow(){
        this.show = true;
      },
      close(){
        this.show = false;
      },
      jump(page){
        this.$router.push({
          name:page
        })
      }
    }
  }
</script>

<style scoped>
  .life {
    padding-bottom: .5rem;
  }

  .lifeWrap {
    width: 100%;
    height: .5rem;
    background-color: #FFFFFF;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    flex-flow: row;
    justify-content: space-around;
    align-items: flex-end;
  }

  .life-item {
    width: .65rem;
    height: 100%;
    color: #666666 !important;
    box-sizing: border-box;
    display: flex;
    flex-flow: column;
    justify-content: flex-end;
    align-items: center;
    font-size: 0;
    padding-bottom: .05rem;
  }

  .life-item > div {
    font-size: .10rem;
    line-height: .11rem;
  }

  .life-item-pt {
    height: .8rem;
    display: flex;
    flex-flow: column;
    align-items: center;
  }

  .life-item-pt img {
    width: .43rem;
    height: .43rem;
    border-radius: 100%;
    border: .1rem solid #ffffff;
  }

  .life-item-jump {

  }

  .life-item-jump img {
    width: .18rem;
    height: .17rem;
    margin-bottom: .05rem;
  }

  /* router-link 切换样式 */
  .router-link-active {
    color: #FF9B2F !important;
  }

  .content {
    padding: .16rem .16rem 1.6rem;
  }
  >>> .van-popup {
    background-color: transparent !important;
  }
  .popBox {
    max-width: 100%;
    box-sizing: border-box;
    height: 2.1rem;
    padding: .25rem .65rem;
    background-color: transparent;
    background-image: url("../../../static/img/beijingtu.png");
    background-repeat: no-repeat;
    background-size: 100%;
    background-position-y: .03rem;
    opacity: 1;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: space-between;
  }
  .popItem {
    height: 100%;
    width: calc(100% / 3);
    display: flex;
    flex-flow: column;
    align-items: flex-start;
    justify-content: center;
  }
  .popItem:nth-child(2) {
    justify-content: space-between;
    align-items: center;
  }
  .popItem:nth-child(3) {
    align-items: flex-end;
  }
  .popItem:nth-child(2)>p {
    display: flex;
    flex-flow: column;
    align-items: center;
  }
  .popItem:nth-child(2)>img {
    margin-bottom: 0;
  }
  .popItem>img,.popItem>p>img {
    width: .44rem;
    height: .44rem;
    margin-bottom: .1rem;
  }
  .popItem>span,.popItem>p>span {
    font-size:.12rem;
    font-family:PingFang SC;
    font-weight:500;
    color: #333333;
  }
</style>
